﻿using FluentNHibernate.Mapping;
using SOLInfo.GEN.Domain.Entities;
using SOLInfo.GEN.Domain.VO;

namespace SOLInfo.GEN.Repository.Mappings
{
    public class CategoriaMapping: ClassMap<Categoria>
    {
        public CategoriaMapping()
        {
            Id(x => x.Codigo);
            Map(x=> x.Nome);
            References<Empresa>(x => x.Empresa)
                .Cascade.SaveUpdate();
            References<Noticia>(x => x.Noticia)
                .Cascade.SaveUpdate();

            Component<Manutencao>(x => x.Criacao, MappingBase.MapManutencao("Criacao"));
            Component<Manutencao>(x => x.UltimaAlteracao, MappingBase.MapManutencao("Alteracao"));
        }
    }
}
